import type { Metadata } from "next";
import List from "./_list";
import Menu from "./_menu";
import style from "./index.module.scss";
import { options } from "@/app/utils";
import Header from "@/app/components/Header";
import Footer from "@/app/components/Footer";
import { getTemplatesByClassify } from "@/service";

export const metadata: Metadata = {};
const titleMap = {
  list: "简历模板_简历制作_免费在线简历制作_百捷简历",
  jianjie: "简洁风格在线简历模板_免费简历制作_百捷简历",
  shuanglan: "双栏风格在线简历模板_免费简历在线制作_百捷简历",
  table: "简历表格在线制作_免费个人简历表格模板_百捷简历",
  yingjiesheng: "应届生简历模板_求职简历模板_百捷简历",
  jingmei: "精美风格简历模板_精美在线简历制作_百捷简历",
  remen: "热门简历模板_求职简历模板_百捷简历",
};
export default async function Home({ params }) {
  const { type } = params;
  const classify = options.find((t) => t.type === type);
  const classifyId = classify?.value || 0;
  const res = await getTemplatesByClassify({
    classify: classifyId,
    order_by: classifyId === 0 ? "id" : "",
  });
  let list = [];
  if (res.code === 200) {
    list = res.data || [];
  }
  metadata.title = titleMap[type];
  metadata.description = `百捷简历设计的${
    type !== "list" ? classify.label : ""
  }简历模板，涵盖了各个行业和专业通用的求职简历模板。求职者可以选择一份免费简历模板快速制作一份专业简历，并随时随地将简历导出为PDF格式文件。这些在线简历模板不仅易于使用，而且能够满足各种求职需求，帮助您在求职过程中脱颖而出。`;
  metadata.keywords = "在线简历模板，简历制作，简历，个人简历模板";

  return (
    <>
      <Header current="muban" style={{ background: "#fff" }} />
      <main className={style.main}>
        <div className={style.container}>
          <div className={style.left}>
            <div className={style.menuWraper}>
              <Menu active={type} />
            </div>
          </div>
          <div className={style.right}>
            <List list={list} />
          </div>
        </div>
        <Footer />
      </main>
    </>
  );
}
